import requests
import random
import string

def generate_password(length=4):
    # 定义字符集，包括字母和数字
    characters = string.ascii_letters + string.digits
    # 从字符集中随机选择指定长度的字符
    password = ''.join(random.choice(characters) for i in range(length))
    return password

def verify_baidu_share(pwd, surl):
    url = 'https://pan.baidu.com/share/verify'
    params = {
        'surl': surl
    }
    headers = {
        'Origin': 'https://pan.baidu.com',
        'Referer': 'https://pan.baidu.com/',
    }
    data = {
        'pwd': pwd
    }

    response = requests.post(url, params=params, headers=headers, data=data)
    return response.text

# 调用函数并打印结果
surl = 'gfxABKZ'
pwd = 'hz56'
result = verify_baidu_share(surl, pwd)
print(result)
